package com.luo.ai.mcp.server.resources;

import com.luo.ai.mcp.server.util.JsonUtils;
import io.modelcontextprotocol.spec.McpSchema;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 我的系统信息Json资源
 *
 * @author luohq
 * @date 2025-04-27 14:31
 */
@Component
public class MySystemInfoResource implements MyBaseResource {
    @Override
    public McpSchema.Resource resourceDesc() {
        //资源描述
        McpSchema.Resource systemInfoResource = new McpSchema.Resource(
                "system/info",
                "System Information",
                "Provides system information",
                MediaType.APPLICATION_JSON_VALUE,
                //可选
                new McpSchema.Annotations(
                        //适用角色
                        List.of(McpSchema.Role.ASSISTANT),
                        //重要性（1最重要, 0最不重要）
                        0D
                )
        );
        return systemInfoResource;
    }


    @Override
    public Object resourceContent() {
        Map systemInfo = Map.of(
                "info", "我是MCP Server"
        );
        String jsonContent = JsonUtils.toJson(systemInfo);
        return jsonContent;
    }
}
